package cn.ehanghai.iot.utils;

import java.util.Random;

/**
 * @Author: xumf
 * @Date: 2019/5/29 15:14
 */
public class KeyUtil {

    /**
     * 生成唯一key
     *
     * @return
     */
    public static synchronized String genUniqueKey() {
        Random random = new Random();
        Integer number = random.nextInt(900) + 100;
        return System.currentTimeMillis() + String.valueOf(number);
    }

    public static void main(String[] args) {
        for (int i = 0; i < 20; i++) {
            System.out.println(genUniqueKey());
        }

    }
}
